#include "cananalysis.h"
#include "ui_cananalysis.h"


//outside initialization instance ptr
Cananalysis* Cananalysis::instance = nullptr;

Cananalysis::Cananalysis(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Cananalysis)
{

    ui->setupUi(this);

}

Cananalysis::~Cananalysis()
{
    delete ui;
}
//make it mutex
Cananalysis* Cananalysis::getInstance()
{
    //multi thread to access it ,may cause compete.
    static QMutex mutex;
    if(!instance)
    {
        //make it to lock to solve thread saftey
        QMutexLocker locker(&mutex);
        if(!instance)
        {
            qDebug()<<"new cananalysis";
            instance = new Cananalysis;
        }
    }
    return instance;
}


void Cananalysis::on_canOpenNetwork_clicked()
{
    CanSettings *instance = CanSettings::getInstance();
    instance->show();
}

